home *** CD-ROM | disk | FTP | other *** search
- ##############################################################################
- # mailfrom.mml
- #
- # MailShield script that is run after the MAIL FROM:<> SMTP command
- #
-
- ##############################################################################
- # (optional) log this MAIL FROM message
- #
- # &LogMessage("SMTP MAIL FROM from: '".$SmtpMailFrom."'");
-
-
- ##############################################################################
- # If this host has been accepted for relaying in begin.mml, the perform no more tests
-
- if ($accept) {
- exit;
- };
-
-
- ##############################################################################
- # check the MAIL FROM to see if on the special approved list.
- if (scalar(@ok_mail_from) > 0) {
- if (index(lc($SmtpMailFrom), @ok_mail_from) > -1) {
- $accept = TRUE;
- &MessageAppend(" (your MAIL FROM address approves you for relaying)");
- exit;
- };
- };
-
-
- ##############################################################################
- # Sleep for a number of seconds if we have been instructed to tarpit this connection.
-
- if ($tarpit) {
- sleep($tarpit_delay);
- };
-
-
- ##############################################################################
- # check for banned MAIL FROM text
-
- if (scalar(@banned_mail_from) > 0) {
- if (index(lc($SmtpMailFrom), @banned_mail_from) > -1) {
- $smtp_message = "550 SMTP session aborted;";
- $log_message = "550 MAIL FROM of '".$SmtpMailFrom."' is banned / matched ".$match;
- &DefaultRejection;
- };
- };
-
-
- ##############################################################################
- # (optional) reject messages with no MAIL FROM, (bounce reports and error
- # mail come in this way)
-
- if ($reject_empty_mail_from) {
- if (length($SmtpMailFrom) == 0) {
- $smtp_message = "550 SMTP session aborted;";
- $log_message = "550 MAIL FROM is not allowed to be empty";
- &DefaultRejection;
- };
- };
-
-
- ##############################################################################
- # (optional) reject messages with source-routed addresses
-
- if ($reject_routed_email) {
- if (index($SmtpMailFrom, "%") > -1) {
- $smtp_message = "550 SMTP session aborted due to source-routing";
- $log_message = "550 Source routing not allowed. MAIL FROM was: '".$SmtpMailFrom."').";
- &DefaultRejection;
- };
- };
-
-
- ##############################################################################
- # check to make sure that the From: address appears to be in a valid syntax
-
- if ($reject_invalid_mail_from) {
- if ((length($SmtpMailFrom) > 0) && (!&EmailAddressValid($SmtpMailFrom))) {
- $smtp_message = "550 Invalid MAIL FROM";
- $log_message = "550 Invalid email address in MAIL FROM: '".$SmtpMailFrom."'";
- &DefaultRejection;
- };
- };
-
-
-